package com.huawei.classroom.student.h05;

public class Barrack extends GameObject {
	
	public Barrack(){
		this.health = 100;
	}
	public Soldier traing(EnumObjectType which) {
		if(which.equals(EnumObjectType.rifleSoldier)) {
			return new RifleSoldier();
		}else if(which.equals(EnumObjectType.RPGSoldier)) {
			return new RPGSoldier();
		}else if(which.equals(EnumObjectType.dog)) {
			return new Dog();
		}else {
			throw new ClassCastException();
		}
		
	}
	
	
}
